Some improvements done, owner deletion started, some bugs remain there
[RRRRHHHH_Code] / ruralHouses client / src / gui / listOfRemovalRequestsGUI.java
index 62daded..071ee51 100644 (file)
@@ -41,8 +41,7 @@ public class listOfRemovalRequestsGUI extends JFrame {
         */
        public listOfRemovalRequestsGUI() {
                try {
-                       am = (AdminInterface) Naming
-                                       .lookup(___IntNames.AdminManager);
+                       am = (AdminInterface) Naming.lookup(___IntNames.AdminManager);
                } catch (Exception e1) {
                        System.out.println("Error accessing remote authentication: "
                                        + e1.toString());
@@ -94,51 +93,50 @@ public class listOfRemovalRequestsGUI extends JFrame {
                btnNewButton.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                                if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
-                                       HouseInterface hm= null;
+                                       HouseInterface hm = null;
                                        try {
                                                hm = (HouseInterface) Naming
                                                                .lookup(___IntNames.HouseManager);
                                        } catch (Exception e1) {
-                                               System.out.println("Error accessing remote authentication: "
-                                                               + e1.toString());
+                                               System.out
+                                                               .println("Error accessing remote authentication: "
+                                                                               + e1.toString());
                                        }
                                        RuralHouse rh = houses.get(table.getSelectedRow());
-                                       ((DefaultTableModel)table.getModel()).removeRow(houses.indexOf(rh));
-                                               try {
-                                                       hm.removeHouse(rh, rh.getOwner());
-                                                       am.removeHouseDeletionRequests(rh);
-                                                       am.saveInstance();
-                                               } catch (RemoteException e1) {
-                                                       // TODO Auto-generated catch block
-                                                       e1.printStackTrace();
-                                               }
-                                               houses.remove(rh);
-                                               
-
-                                       
+
+                                       try {
+                                               hm.removeHouse(rh, rh.getOwner());
+                                               am.removeHouseDeletionRequests(rh);
+                                               am.saveInstance();
+                                       } catch (RemoteException e1) {
+                                               // TODO Auto-generated catch block
+                                               e1.printStackTrace();
+                                       }
+                                       ((DefaultTableModel) table.getModel()).removeRow(houses
+                                                       .indexOf(rh));
+
                                }
                        }
                });
                btnNewButton.setBounds(90, 396, 169, 25);
                contentPane.add(btnNewButton);
-               
+
                JButton btnNewButton_1 = new JButton("Deny Deletion");
                btnNewButton_1.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                                if (table.getRowCount() != 0 && table.getSelectedRow() != -1) {
                                        RuralHouse rh = houses.get(table.getSelectedRow());
-                                       ((DefaultTableModel)table.getModel()).removeRow(houses.indexOf(rh));
-                                               houses.remove(rh);
-                                               try {
-                                                       am.removeHouseDeletionRequests(rh);
-                                                       am.saveInstance();
-                                               } catch (RemoteException e1) {
-                                                       // TODO Auto-generated catch block
-                                                       e1.printStackTrace();
-                                               }
-                                               
-
-                                       
+                                       ((DefaultTableModel) table.getModel()).removeRow(houses
+                                                       .indexOf(rh));
+                                       houses.remove(rh);
+                                       try {
+                                               am.removeHouseDeletionRequests(rh);
+                                               am.saveInstance();
+                                       } catch (RemoteException e1) {
+                                               // TODO Auto-generated catch block
+                                               e1.printStackTrace();
+                                       }
+
                                }
                        }
                });